ScrolledWindow: Dodge possible surplus disconnects
authorDaniel Boles <dboles@src.gnome.org>
Fri, 1 Sep 2017 15:03:36 +0000 (16:03 +0100)
committerDaniel Boles <dboles@src.gnome.org>
Fri, 1 Sep 2017 15:28:57 +0000 (16:28 +0100)
In case the outgoing Adjustment for whatever reason has other handlers
referring to this SW, be sure to avoid disconnecting any but our own.

gtk/gtkscrolledwindow.c

index 99245c78702a1e75e6105c0c1fe51c48e8ab3799..4a7e64e82a070cbbae981bd065836286fc900038 100644 (file)
@@ -2019,7 +2019,12 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
       if (old_adjustment == hadjustment)
        return;
 
-      g_signal_handlers_disconnect_by_data (old_adjustment, scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_changed,
+                                            scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_value_changed,
+                                            scrolled_window);
 
       gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
       gtk_scrollbar_set_adjustment (GTK_SCROLLBAR (priv->hscrollbar), hadjustment);
@@ -2089,7 +2094,12 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
       if (old_adjustment == vadjustment)
        return;
 
-      g_signal_handlers_disconnect_by_data (old_adjustment, scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_changed,
+                                            scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_value_changed,
+                                            scrolled_window);
 
       gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
       gtk_scrollbar_set_adjustment (GTK_SCROLLBAR (priv->vscrollbar), vadjustment);